import Vue from 'vue'
import VueRouter from 'vue-router'

import Login from '../views/login/Login.vue'
import Main from '../views/main/index.vue'
import Home from '../views/Home.vue'
const ResourceCrud = () => import('../views/resourceCrud/index.vue')

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  
  {
    path: '/main',
    name: 'Main',
    component: Main,
    children: [
      {name:'home',path:'/home',component:Home},
      {name:'resource-crud',path:'/:resource/list',component:ResourceCrud,props:true}
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: Login
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})



export default router
